home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / wildhearts_stage_dive.swf / scripts / DefineSprite_101 / frame_2 / DoAction.as < prev   
Text File  |  2011-08-19  |  770b  |  36 lines

  1. var listener = new Object();
  2. listener.t = this;
  3. listener.onKeyDown = function()
  4. {
  5.    if(!this.t.isPaused)
  6.    {
  7.       if(Key.getCode() == this.t.keys[this.t.curKey])
  8.       {
  9.          this.t.i = this.t.i + 1;
  10.          this.t.curKey = (this.t.curKey + 1) % 2;
  11.       }
  12.       if(Key.getCode() == this.t.keys[2] && !this.t.door && !(this.t.numPlayers == 1 && this.t.curPlayer == 2))
  13.       {
  14.          this.t.jumping = true;
  15.       }
  16.    }
  17.    if(Key.getCode() == 19)
  18.    {
  19.       this.t.pauseGame();
  20.    }
  21. };
  22. listener.onKeyUp = function()
  23. {
  24.    if(!this.t.isPaused)
  25.    {
  26.       if(this.t.jumping)
  27.       {
  28.          if(Key.getCode() == this.t.keys[2])
  29.          {
  30.             this.t.endJump = true;
  31.          }
  32.       }
  33.    }
  34. };
  35. Key.addListener(listener);
  36.